import router from '@/middleware/router'
import { JsonDB } from '@/utils/JsonDB'
import path from 'path'

router.get('/demo', (ctx) => {

  const dataJSON = path.join(__dirname, '../assets/data.json')
  const db = new JsonDB(dataJSON)
  // db.set('list', ['1'])
  db.addAsync('list', '2')

  const data = db.get('list')

  ctx.body = { code: 200, data }
})